package cn.itcast.xuesheng.servlet.Interceptor;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.web.servlet.HandlerInterceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.File;

public class SenstiveWordsInterceptor implements HandlerInterceptor {
    @Test
    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
        String title = request.getParameter("title");
        String context = request.getParameter("context");
        String path = SenstiveWordsInterceptor.class.getClassLoader().getResource("敏感词汇.txt").getFile();
        System.out.println(path);
        File file1=new File(path);
        return false;
    }
}
